package demo.proxy;

public class HouseProxy implements HouseSubject{
    private HouseSubject target;

    public HouseProxy(HouseSubject target){
        this.target = target;
    }

    @Override
    public void rentHouse() {
        //出租前
        System.out.println("中介，开始代理");
        //出租房子
        target.rentHouse();
        //出租后
        System.out.println("中介，结束代理");
    }

    @Override
    public void saleHouse() {
        System.out.println("中介，开始代理");
        target.saleHouse();
        System.out.println("中介，结束代理");
    }
}
